import urllib2,urllib
# response = urllib2.urlopen("http://www.baidu.com")
# print response.read()
'''
value = {'username':'chobit','password':'123456789'}
data = urllib.urlencode(value)
print data

httpHandler = urllib2.HTTPHandler(debuglevel=1)
httpsHandler = urllib2.HTTPSHandler(debuglevel=1)
opener = urllib2.build_opener(httpHandler, httpsHandler)
urllib2.install_opener(opener)
response = urllib2.urlopen("http://www.baidu.com")
'''
# requset = urllib2.Request('http://www.baidu.com')
# response = urllib2.urlopen(requset)
# '''
# try:
# 	urllib2.urlopen(requset)
# except urllib2.URLError,e:
# 	print e.reason
# '''
# print response.read()
# # print 

req = urllib2.Request('http://blog.csdn.net/cqcre')
try:
	urllib2.urlopen(req)
except urllib2.HTTPError,e:
	print e.code
	print e.reason